package org.example;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test2 {
    public List<Integer> findMinHeightTrees(int n, int[][] edges) {
        Map<Integer,Integer> hash = new HashMap<>();
        List<Integer> ret = new ArrayList<>();
        for (int i = 0; i < edges.length; i++) {
            Integer a = hash.getOrDefault(edges[i][0],0);
            Integer b = hash.getOrDefault(edges[i][1],0);
            if (a == 1) ret.add(edges[i][0]);
            if (b == 1) ret.add(edges[i][1]);
            hash.put(edges[i][0],a + 1);
            hash.put(edges[i][1],b + 1);
        }
        for (Map.Entry<Integer,Integer> entry : hash.entrySet()) {
            entry.getKey()
        }
        return ret;
    }

    public static void main(String[] args) {
        int[][] edges = new int[5][2];
        edges[0][0] = 3;
        edges[0][1] = 0;
        edges[1][0] = 3;
        edges[1][1] = 1;
        edges[2][0] = 3;
        edges[2][1] = 2;
        edges[3][0] = 3;
        edges[3][1] = 4;
        edges[4][0] = 5;
        edges[4][1] = 4;
        Test2 test2 = new Test2();
        test2.findMinHeightTrees(10,edges);
        System.out.println(666);
    }
}
